import { defineStore } from 'pinia'
import { useStaticUrl } from '@/util'

export const mainStore = defineStore('main', {
  state: () => {
    return {
      login: useStaticUrl('../assets/images/login.png')
    }
  },
  // 开启持久化
  persist: {
    enabled: true,
    strategies: [
      { storage: localStorage, paths: ['login'] }
    ]
  },
  getters: {},
  actions: {
    changeHeadShot() {
      console.log('数据存储成功')
      this.login = useStaticUrl('../assets/images/head.png')
    }
  }
})